package com.train.system.api;

import com.train.common.constants.ApiConstants;
import com.train.common.resp.CommonResp;
import com.train.system.api.fallback.TrainApiImplFallback;
import com.train.system.dto.train.TrainPageDTO;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * train Facade 接口
 * @author baitiaojun
 * @createDate 2025-02-20 01:04:22
 */
@FeignClient(
        contextId = "trainFacade",
        name = ApiConstants.SYSTEM_NAME,
        path = ApiConstants.SYSTEM_PREFIX,
        fallback = TrainApiImplFallback.class)
public interface TrainApi {

    String PREFIX = "/train";

    @PostMapping(PREFIX + "/list")
    CommonResp getTrainList(@RequestBody @Validated TrainPageDTO trainPageDTO);

    @PostMapping(PREFIX + "/valid/train-code")
    CommonResp validTrainCodeList(@RequestBody @NotEmpty(message = "车次编号不能为空") String trainCode);

    @PostMapping(PREFIX + "/trainListByTrainCodes")
    CommonResp getTrainListByTrainCodes(@RequestBody @NotEmpty(message = "车次编号不能为空") List<String> trainCodes);
}
